{% extends "repo_master.html" %}

{% block title %}Releases - {{ repo.name }}{% endblock %}
{% set tag = "home" %}

{% block repo %}

<h2>
  Releases
{% if config.get('UPLOAD_FOLDER_PATH') and config.get('UPLOAD_FOLDER') %}
  {% if repo_admin %}
    <a class="pull-xs-right" href="{{ url_for('.new_release', username=username, repo=repo.name) }}"
        method="get" class="icon">
    <button class="btn btn-primary" type="submit" title="Upload a tarball">
      <span class="icon icon-plus blue"></span>
      Upload a new release
    </button>
    </a>
  {% endif %}
{% endif %}
</h2>

{% if config.get('UPLOAD_FOLDER_PATH') and config.get('UPLOAD_FOLDER') %}
<p>
  If the developers have upload one or more tarball(s), you will be able to
  find them in the <a href="{{ config['APP_URL'] + config['UPLOAD_FOLDER'] + repo.fullname }}">
    release folder.
  </a>
</p>
{% endif %}

<section class="tag_list">
  {% if tags %}
  <div class="list-group">
    {% for tag in tags %}
      <a class="list-group-item" href="{{ url_for('.view_tree',
                    username=username, repo=repo.name,
                    identifier=tag['object'].oid) }}">
        <div class="pull-xs-right">{{tag['date'] | humanize}}
          <span id="tagid" class="label label-default">
            {{ tag['object'].oid | short }}
          </span>
        </div>
        {% if tag['objecttype'] == "tag" and tag['object'].message.strip() %}
            <strong>{{tag['tagname']}}</strong>
            {{ tag['head_msg'] }}
            {% if tag['body_msg'] %}
            <div style="white-space:pre-wrap">
              {{ tag['body_msg'] }}
            </div>
            {% endif %}
        {% else %}
            <strong>{{tag['tagname']}}</strong>
        {% endif %}
      </a>
    {% endfor %}
  </div>
  {% else %}
  <p>
    This project has not been tagged.
  </p>
  {% endif %}
</section>

{% endblock %}
